import jsonschema
data = {
    "success": False,
    "code": 10000,
    "message": "xxx登录成功",
    "data": {
            "age": 20,
            "name": "lily"
        }
    }
schema = {
    "type":"object",
    "properties":{
        "success":{"type":"boolean"},
        "code":{"const":10000},
        "message":{"pattern":"登录成功$"},
        "data":{"type":"object",
                "properties":{
                    "age":{"const":20},
                    "name":{"type":"string"},
                },
                "required": ["age", "name"]
                },
    },
    "required": ["success", "code", "message", "data"]
}
jsonschema.validate(instance=data,schema=schema)